#java programming language mcq
Explore tagged Tumblr posts
desklibai · 25 days ago
Text
Desklib: Your Smart Academic Companion for Smarter Learning
In today’s digital era, students and educators are no longer limited to traditional textbooks and handwritten notes. The rise of artificial intelligence has transformed how we learn, teach, and evaluate knowledge. At the forefront of this educational revolution is Desklib — an all-in-one academic platform powered by cutting-edge AI tools like AI Grader, AI Code Checker, AI Quiz, AI Answers, AI Paraphraser, Study Documents, AI Detector, and Plagiarism Checker.
Whether you're preparing for exams, writing research papers, coding assignments, or even creating interactive quizzes, Desklib offers a suite of intelligent tools that simplify your learning journey. Let’s dive into how each feature can empower you to study smarter, not harder.
📚 Why Desklib Stands Out in Today’s Academic Landscape
With so many online platforms promising academic success, what makes Desklib different? It’s not just another website—it’s your personal academic assistant. Designed with real users in mind, Desklib blends artificial intelligence with human-centric design, making it easy, intuitive, and effective for learners of all ages.
Let’s explore the powerful tools that make Desklib a must-have for students, teachers, and professionals alike.
✅ AI Grader – Instant Feedback That Helps You Improve
Grading can be time-consuming and subjective—especially when dealing with essays, short answers, or complex problem sets. Enter AI Grader, a smart grading system that evaluates written responses quickly and accurately.
This tool uses natural language processing to understand context, grammar, structure, and content quality. Whether you're a teacher managing a class of 50 or a student practicing essay writing, AI Grader provides:
Instant feedback
Detailed scoring
Suggestions for improvement
Consistent evaluation standards
It’s like having a virtual teaching assistant available 24/7.
💻 AI Code Checker – Debug Like a Pro
For programming students and developers, writing clean, functional code is essential. But even the best coders make mistakes. That’s where the AI Code Checker comes in.
This tool scans your code for syntax errors, logical flaws, and performance issues. It supports multiple languages like Python, Java, C++, and more. What makes it stand out?
Real-time error detection
Intelligent suggestions for optimization
Explanation of common bugs
Integration with popular IDEs
Whether you're working on a university project or prepping for a technical interview, the AI Code Checker ensures your code is clean, efficient, and ready to run.
🧠 AI Quiz – Turn Learning Into a Game
Learning should be fun—and with AI Quiz, it is. This interactive tool transforms your study material into engaging quizzes tailored to your understanding level.
How does it work?
Input your topic or upload a document
Choose quiz type: MCQs, fill-in-the-blanks, true/false
Get instant results with explanations
Perfect for revision, test prep, or classroom engagement, AI Quiz keeps learners motivated and helps reinforce key concepts through gamification.
Tumblr media
Teachers can also use this feature to create dynamic assessments and monitor student progress in real-time.
❓ AI Answers – Your Personal Knowledge Assistant
Got a question? Ask AI Answers. Whether it's a tricky math problem, a historical event, or a scientific concept, this tool gives you quick, accurate, and reliable responses based on credible sources.
Unlike generic search engines, AI Answers doesn’t just give you links—it gives you clear, concise explanations. Ideal for:
Homework help
Quick fact-checking
Concept clarification
Research support
Think of it as your 24/7 academic tutor, always ready to assist.
🔄 AI Paraphraser – Reword Without Losing Meaning
Originality is crucial in academic writing. But sometimes, finding the right way to rephrase a sentence without changing its meaning can be tough. That’s where AI Paraphraser shines.
This advanced tool understands context, tone, and intent. It helps you:
Avoid plagiarism
Enhance clarity
Improve readability
Maintain original meaning
Whether you’re rewriting an essay, preparing a presentation, or summarizing research, the AI Paraphraser ensures your work stays authentic and impactful.
🗂️ Study Documents – Organize, Store & Share
Managing study materials can be chaotic. With Study Documents, you can store, categorize, and access all your files in one place. No more lost PDFs or cluttered folders.
Features include:
Cloud-based storage
Easy tagging and search
Collaborative sharing
Offline access
Ideal for group projects, research teams, or individual learners, Study Documents brings order to your academic life.
🔍 AI Detector – Spot AI-Written Content Fast
As AI-generated text becomes more prevalent, maintaining authenticity in academic work is more important than ever. The AI Detector analyzes text to determine if it was written by a human or generated by AI.
Why use it?
Ensure academic integrity
Detect AI-written essays
Maintain fairness in assessments
Promote genuine learning
Educators, institutions, and students can rely on this tool to uphold high standards of originality and critical thinking.
🚫 Plagiarism Checker – Protect Your Original Work
Plagiarism is a serious offense in academia. To ensure your work is truly yours, Desklib offers a powerful Plagiarism Checker that scans your documents against billions of web pages and academic databases.
Key benefits:
Comprehensive similarity reports
Source identification
Multiple file format support
Fast and accurate results
Use it before submitting assignments, publishing research, or presenting at conferences to maintain credibility and avoid unintentional copying.
💬 Real Stories from Real Users
Don’t just take our word for it. Hear from students and educators who’ve made Desklib part of their daily routine.
"The Plagiarism Checker helped me catch accidental duplication in my thesis. I submitted confidently knowing my work was original." – Priya, PhD Candidate
"I use AI Answers every day for quick homework help. It saves me so much time!" – Noah, High School Student
"AI Grader changed how I assess my students. It's fast, fair, and gives them valuable insights." – Mr. Johnson, University Professor
These stories reflect the real impact Desklib has on everyday learning.
📰 Stay Updated with Our Blog
At Desklib, we believe learning never stops. That’s why we regularly publish articles, guides, and expert tips on our blog. From mastering AI tools to improving study habits, there’s always something new to discover.
Check out our latest posts:
“How to Ace Your Coding Assignments Using AI”
“Top 5 Tips for Effective Exam Revision”
“Understanding AI Ethics in Education”
Stay ahead of the curve with expert insights and actionable advice.
🌐 Visit Desklib Today!
Ready to experience the future of learning? Explore everything Desklib has to offer at https://desklib.com/. Whether you're a student, educator, researcher, or professional, our AI-powered tools are designed to support your academic goals.
From AI Grader to Plagiarism Checker, Desklib empowers you to learn smarter, write better, and stay ahead of the competition.
🧩 Final Thoughts: Embrace AI for Better Learning
Artificial Intelligence is no longer a futuristic concept—it's here, and it's transforming education. Tools like AI Grader, AI Code Checker, AI Quiz, AI Answers, AI Paraphraser, Study Documents, AI Detector, and Plagiarism Checker are becoming essential components of modern learning.
By integrating these technologies into your study routine, you open doors to:
Improved efficiency
Deeper understanding
Enhanced creativity
Greater academic success
So why wait? Discover the power of AI with Desklib and unlock your full potential.
👉 Start your journey today at https://desklib.com/. Join thousands of students and educators who are already embracing smarter learning.
0 notes
annyjones · 4 months ago
Text
0 notes
scholarhatedu · 1 year ago
Text
0 notes
jawaab24x7 · 3 years ago
Text
Comment down the correct answer to this question to get $150
What type of value is returned by Math.sqrt( )?
a) int
b) float
c) double
d) All
Click here to see the answer
1 note · View note
sakshimohitedf · 5 years ago
Link
0 notes
interviewmocks-blog · 5 years ago
Text
Interview Questions and Mock Interview MCQ & Quiz
InterviewMocks: Best Interview Preparation App for Software Engineers and Designers
InterviewMocks is best aap for preparing interview questions on programming languages like java, css, html, and many more programming languages and tools here you can learn/  read best interview questions on programming languages and IT MCQ and many more Quizess
1 note · View note
highskyit · 2 years ago
Text
Get an Insight into the Highly Beneficial Docker Certified Associate (DCA) Exam
In this constantly thriving technological world, the Docker Containers are an integral part. One, who is willing to up skill in terms of enhancing his /her career in technology arena, must be aware of it on priority.
For everyone who is unaware of it, Docker is the enterprise-ready container platform, which enables the organisations to build, share & run apps almost anywhere. The business world is now leveraging the potential of app containerisation, for speeding up the production workloads, for ensuring anytime deployment.
To implement such technology, businesses need professionals with right skill set. And, Docker offers its DCA (Docker Certified Associate) examination, for filtering out the best talents from the crowd. So, let’s get a better insight into what is this certification about.
Why Should One Take the DCA Examination?
If you are looking for a Docker Certification in Ahmedabad, then DCA seems to be the right fit for your needs. But, why should it be considered in specific? It is because; most of the apps today are built for the cloud infrastructure. Hence, this increases the demands for the apps to be containerised to speed up deployments, anytime and anywhere.
Docker containerisation is one of the most sought-after skills that the companies are highly demanding today. It is mostly because, a lot of businesses are now migrating their legacy apps into cloud apps, or are building new-gen cloud native apps. Thus, it is considered the right time for anyone to take up the DCA examination
Prerequisites for Taking up the DCA Examination
There are no prerequisites for taking up this examination, but if you have prior knowledge on cloud computing, clearing DCA would be pretty much easy for you. If you are investing your time, money and efforts on getting Cloud Computing Training in Ahmedabad, a Docker certification would help you enhance your capabilities further.
About the DCA Exam
DCA examination will be in the MCQ format, with 55 questions, which should be completed within 90 minutes. The cost of availing the examination is $195, and there are no free retakes for it.
Conclusion
Learning and implementing cloud computing is important, and so is mastering various programming languages. Therefore, you can definitely seek Java, C# or Python courses in Ahmedabad, to give your development career a start. Following that, get used to the cloud computing arena, by taking up Microsoft Azure certification Ahmedabad.
When you feel like you have enough experience to take on the cloud app development concepts, lock your career with the DCA examination. You can get all of these certifications under one roof, and that is HighSky IT Solutions Check out the website or get in touch with their consultants to learn more.
0 notes
scholarhatedu · 1 year ago
Text
0 notes
equal-growth · 5 years ago
Photo
Tumblr media
Guy's which programming language going to be more popular in the future ?🖥⌨️ Comment down your words!
Follow ➡️ Python_Techno for more content.
Computer Science CareersComputer KnowledgeComputer programming (C, C++, C#, Python, Java, Android) developersComputer Science,Information Technology MCQS & More- Shahnoor NasirComputer Science and Programming Language AcademyComputer Science Students
#programminglanguage #programming #python3 #python #java #future #language #popular #new #instagramalgorithm #algorithms #techno #technique
0 notes
siva3155 · 6 years ago
Text
300+ TOP JAVA SPRING Objective Questions and Answers
Java Spring Multiple Choice Questions :-
1. What is the meaning of the return data type void? A. An empty memory space is returned so that the developers can utilize it. B. void returns no data type. C. void is not supported in Java D. None of the above Ans: B 2. A lower precision can be assigned to a higher precision value in JavA. For example a byte type data can be assigned to int type. A. True B. False Ans : B 3. Which of the following statements about the Java language is true? A. Both procedural and OOP are supported in JavA. B. Java supports only procedural approach towards programming. C. Java supports only OOP approach. D. None of the above. Ans: A 4. Which of the following statements is false about objects? A. An instance of a class is an object B. Objects can access both static and instance data C. Object is the super class of all other classes D. Objects do not permit encapsulation Ans: D 5. Which methods can access to private attributes of a class? A. Only Static methods of the same class B. Only instances of the same class C. Only methods those defined in the same class D. Only classes available in the same package. Ans: C 6. What is an aggregate object? A. An object with only primitive attributes B. An instance of a class which has only static methods C. An instance which has other objects D. None of the above Ans: C 7. Assume that File is an abstract class and has toFile() methoD. ImageFile and BinaryFile are concrete classes of the abstract class File. Also, assume that the method toFile() is implemented in both Binary File and Image File. A File references an ImageFile object in memory and the toFile method is called, which implementation method will be called? A. Binary File B. Image File C. Both File and Binary Files D. None of the above Ans: B 8. A class can have many methods with the same name as long as the number of parameters or type of parameters is different. This OOP concept is known as A. Method Invocating B. Method Overriding C. Method Labeling D. Method Overloading Ans: D 9. Which of the following is considered as a blue print that defines the variables and methods common to all of its objects of a specific kind? A. Object B. Class C. Method D. Real data types Ans: B 10. What are the two parts of a value of type double? A. Significant Digits, Exponent B. Length, Denominator C. Mode, Numerator Ans: A
Tumblr media
JAVA SPRING MCQs 11. After the following code fragment, what is the value in fname? String str; int fname; str = "Foolish boy."; fname = str.indexOf("fool"); A. 0 B. 2 C. -1 D. 4 Ans: C 12. What is the value of ‘number’ after the following code fragment execution? int number = 0; int number2 = 12 while (number { number = number + 1; } A. 5 B. 12 C. 21 D. 13 Ans: B 13. Given the following code snippet; int salaries[; int index = 0; salaries = new int salaries[4; while (index { salaries[index = 10000; index++; } What is the value of salaries [3? A. 40000 B. 50000 C. 15000 D. 10000 Ans: D 14. Which of the following is not a return type? A. boolean B. void C. public D. Button Ans: C 15. If result = 2 + 3 * 5, what is the value and type of ‘result’ variable? A. 17, byte B. 25, byte C. 17, int D. 25, int Ans: C 16. What is the data type for the number 9.6352? A. float B. double C. Float D. Double Ans: B 17. Assume that the value 3929.92 is of type ‘float’. How to assign this value after declaring the variable ‘interest’ of type float? A. interest = 3929.92 B. interest = (Float)3929.92 C. interest = 3929.92 (float) D. interest = 3929.92f Ans: D 18. Which of the following statements is true? A. The default char data type is a space( ‘ ‘ ) character. B. The default integer data type is ‘int’ and real data type is ‘float’ C. The default integer data type is ‘long’ and real data type is ‘float’ D. The default integer data type is ‘int’ and real data type is ‘double’ Ans: D 19. How many numeric data types are supported in Java? A. 8 B. 4 C. 2 D. 6 Ans: D 20. Which of the following statements declare class Sample to belong to the payroll.admindept package? A. package payroll;package admindept; B. import payroll.*; C. package payroll.admindept.Sample; D. import payroll.admindept.*; E. package payroll.admindept; Ans: E 21. The class javA.lang.Exception is A. protected B. extends Throwable C. implements Throwable D. serializable Ans: B 22. Which of the following statements is true? A. An exception can be thrown by throw keyword explicitly. B. An exception can be thrown by throws keyword explicitly. Ans: A 23. All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in java A. are private B. are serializable C. are immutatable D. are final Ans: D 24. The code snippet if( "Welcome".trim() == "Welcome".trim() ) System.out.println("Equal"); else System.out.println("Not Equal"); will A. compile and display “Equal” B. compile and display “Not Equal” C. cause a compiler error D. compile and display NULL Ans: C 25. Consider the following code snippet. What will be assigned to the variable fourthChar, if the code is executed? String str = new String(“Java”); char fourthChar = str.charAt(4); A. ‘a’ B. ‘v’ C. throws StringIndexOutofBoundsException D. null character Ans: C 26. Which of the following statements is preferred to create a string "Welcome to Java Programming"? A. String str = “Welcome to Java Programming” B. String str = new String( “Welcome to Java Programming” ) C. String str; str = “Welcome to Java Programming” D. String str; str = new String (“Welcome to Java Programming” ) Ans: A 27. Which of the following statements is true? A. A super class is a sub set of a sub class B. class ClassTwo extends ClassOne means ClassOne is a subclass C. class ClassTwo extends ClassOne means ClassTow is a super class D. the class Class is the super class of all other classes in JavA. Ans: A 28. What kind of thread is the Garbage collector thread is? A. Non daemon thread B. Daemon thread C. Thread with dead state D. None of the above Ans: B 29. When a thread terminates its processing, into what state that thread enters? A. Running state B. Waiting state C. Dead state D. Beginning state Ans: C 30. Which statement is true? A. HashTable is a sub class of Dictionary B. ArrayList is a sub class of Vector C. LinkedList is a subclass of ArrayList D. Vector is a subclass of Stack Ans: A 31. Which of these statements is true? A. LinkedList extends List B. AbstractSet extends Set C. HashSet extends AbstractSet D. WeakHashMap extends HashMap Ans: C 32. Which of the following is synchronized? A. Set B. LinkedList C. Vector D. WeakHashMap Ans: C 33. Select all the true statements from the following. A. AbstractSet extends AbstractCollection B. AbstractList extends AbstractCollection C. HashSet extends AbstractSet D. Vector extends AbstractList E. All of the above Ans: E 34. Which of the methods should be implemented if any class implements the Runnable interface? A. start() B. run() C. wait() D. notify() and notifyAll() Ans: B 35. A thread which has invoked wait() method of an object, still owns the lock of the object. Is this statement true or false? A. True B. False Ans: B 36. Which of the following is not a method of the Thread class. A. public void run() B. public void start() C. public void exit() D. public final int getPriority() Ans: C 37. To execute the threads one after another A. the keyword synchronize is used B. the keyword synchronizable is used C. the keyword synchronized is used D. None of the above Ans: B 38. The object of DataInputStream is used to A. To covert binary stream into character stream B. To covert character stream into binary stream C. To write data onto output object D. All of the above Ans: A 39. DataInputStream is an example of A. Output stream B. I/O stream C. Filtered stream D. File stream Ans: C 40. From a MVC perspective, Struts provides the A. Model B. View C. Controller Ans: B 41.Consider the following program: import myLibrary.*; public class ShowSomeClass { // code for the class... } What is the name of the java file containing this program? A. myLibrary.java B. ShowSomeClass.java C. ShowSomeClass D. ShowSomeClass.class E. Any file name with the java suffix will do Ans: B 42.Which of the following is TRUE? A. In java, an instance field declared public generates a compilation error. B. int is the name of a class available in the package javA.lang C. Instance variable names may only contain letters and digits. D. A class has always a constructor (possibly automatically supplied by the java compiler). E. The more comments in a program, the faster the program runs. Ans: D 43.Consider the following code snippet String river = new String(“Columbia”); System.out.println(river.length()); What is printed? A. 6 B. 7 C. 8 D. Columbia E. river Ans: C 44. A constructor A. must have the same name as the class it is declared within. B. is used to create objects. C. may be declared private D. A and B E. A, B and C Ans: E 45.Which of the following may be part of a class definition? A. instance variables B. instance methods C. constructors D. all of the above E. none of the above Ans: D 46.What is different between a Java applet and a Java application? A. An application can in general be trusted whereas an applet can't. B. An applet must be executed in a browser environment. C. An applet is not able to access the files of the computer it runs on D. (A), (B) and (C). E. None of the above Ans: D 47.Consider public class MyClass{ public MyClass(){/*code*/} // more code... } To instantiate MyClass, you would write? A. MyClass mc = new MyClass(); B. MyClass mc = MyClass(); C. MyClass mc = MyClass; D. MyClass mc = new MyClass; E. It can't be done. The constructor of MyClass should be defined as public void MyClass(){/*code*/} Ans: A 48.What is byte code in the context of Java? A. The type of code generated by a Java compiler B. The type of code generated by a Java Virtual Machine C. It is another name for a Java source file D. It is the code written within the instance methods of a class. E. It is another name for comments written within a program. Ans: A 49.What is garbage collection in the context of Java? A. The operating system periodically deletes all of the java files available on the system. B. Any package imported in a program and not used is automatically deleteD. C. When all references to an object are gone, the memory used by the object is automatically reclaimeD. D. The JVM checks the output of any Java program and deletes anything that doesn't make sense. E. Janitors working for Sun MicroSystems are required to throw away any Microsoft documentation found in the employees' offices. Ans: c 50.You read the following statement in a Java program that compiles and executes. submarine.dive(depth); What can you say for sure? A. depth must be an int B. dive must be a methoD.(ans) C. dive must be the name of an instance fielD. D. submarine must be the name of a class E. submarine must be a methoD. Ans: B 51.  Formed on a diskette (or hard drive) during initialization. A. source code B. images C. sectors D. storage units Ans: C 52.  The CPU consists of: A. Control Unit, Temporary Memory, Output B. Control Unit, Arithmetic Logic Unit, Temporary Memory C. Input, Process, Storage, Output D. Input, Control Unit, Arithmetic Logic Unit, Output Ans: B 53.  OOP stands for: A. Observable Object Programming B. Object Observed Procedures C. Object Oriented Programming D. Object Overloading Practices Ans: C 54.  Output printed on paper. A. softcopy B. hardcopy C. source code D. software Ans: B 55.  A binary digit (1 or 0) signifying "on" or "off". A. bit B. byte C. megabyte D. gigabyte Ans: A 56.  Our decimal number 44, when represented in binary, is: A. 101100 B. 101010 C. 111000 D. 10100 Ans: A 57.  Byte code is the machine language for a hypothetical computer called the: A. Java Byte Code Compiler B. Java Byte Code Interpreter C. Java Virtual Machine D. Java Memory Machine Ans: C 58.  Equals 8 bits. A. megabyte B. gigabyte C. sector D. byte Ans: D 59.  Java allows for three forms of commenting: A. // single line, ** block lines, /*/ documentation B. // single line, /*...*/ block lines, /**...*/ documentation C. / single line, /* block lines, ** documentation D. // single line, //...// block lines, //*...*// documentation Ans: B 60.  To prepare a diskette (or hard drive) to receive information. A. format B. track C. interpret D. boot Ans: A 61.  In Java, the name of the class must be the same as the name of  the .java file. A. false B. true - but case sensitivity does not apply C. true - but additional numbers may be added to the name D. true Ans: D 62.  The name Java was derived from A. a cup of coffee B. an acronym for JBuilder Activated Variable Assembly C. an acronym for Juxtapositioned Activated Variable Actions D. an acronym for John's Answer for Various Accounts Ans: A 63.  Programs that tell a computer what to do. A. harware B. software C. hard copy D. projects Ans: B 64.  RAM stands for _________. A. Read Anytime Memory B. Read Allocated Memory C. Random Access Memory D. Random Allocated Memory Ans: C 65.  Several computers linked to a server to share programs and storage space. A. library B. grouping C. network D. integrated system Ans: C 66.  Source code in Java will not run if it is not indenteD. A. true B. false Ans: B 67.  When working in Java with JBuilder, each program you write should be assigned to a new project. A. true B. false Ans: A 68.  The four equipment functions of a computer system. A. Input, Process, Control Unit, Output B. Input, Control Unit, Arithmetic Logic Unit, Output C. Input, Process, Storage, Output D. Input, Process, Library Linking, Output Ans: C 69.  Translates and executes a program line by line. A. compiler B. interpreter C. linker D. control unit Ans: B 70.  The physical components of a computer system. A. control unit B. hardware C. software D. ALU Ans: B JAVA SPRING Questions and Answers pdf Download Read the full article
0 notes
techandguru-blog · 6 years ago
Link
Almost everything is driven by date and time in today's world. People started equating time with money. So computer and programming languages have a way to date time measure implementation. In this post, I will get you through date and time in java. We will see the date and time in java in detail with example. 
Tumblr media
Java Date
Java has Date class implementation in java.util package. This class has the current date and time implementation too. Date class has two constructors as shown below:
- Date(): this constructor initializes the class with the current date and time.
- Date(long milliseconds): this constructor takes millisecond of the date since midnight 1 Jan 1970 and initializes the date and time accordingly.
Like other java class, Date class also has certain methods. Commonly used Date methods are listed below:
Method Signature Method Description boolean after(Date date) returns true if invoking date object contains a date that is later than the date in the argument date object boolean before(Date date) return true if invoking date object contains a date that is earlier than the date in the argument date object Object clone( ) create the duplicate of the invoking date object. It creates new references. int compareTo(Date date) Compares the value of the invoking object with that of date. Returns 0 if the values are equal. Returns a negative value if the invoking object is earlier than date. Returns a positive value if the invoking object is later than date. int compareTo(Object obj) it is same as of compareTo(Date date) provided argument type is of Date otherwise it throws ClassCastException. boolean equals(Object date) return true if invoking date object and argument date object contains same date and time otherwise false. [argument should be of type Date] long getTime( ) returns the milliseconds since midnight of 1 Jan 1970 for the invoking object int hashCode( ) returns hashcode of invoking the object void setTime(long time) initializes the date and time of the invoking object with the argument. String toString( )  Converts the invoking Date object into a string and returns the result. 
GETTING CURRENT DATE AND TIME IN JAVA:
In two ways you can have current date and time using Date class
- by retrieving millisecond of the Date object
- by retrieving String of Date object
e.g.  import java.util.Date; public class DateDemo { public static void main(String args[]) { // Instantiate an object date of Date class Date date = new Date(); // display time and date using toString() System.out.println(date.toString()); // display millisecond of date using getTime() System.out.println(date.getTime()); } }
COMPARING DATES IN JAVA
Date and time in java can be compared using three approaches
- getting milliseconds of the Date objects and comparing them
- using compareTo(Date date) method of the Date class
- using before(Date date), after(Date date) and equal(Date date) method of the Date class.
Date and Time formatting using SimpleDateFormat:
SimpleDateFormat class is the concrete way to format date. It has a locale-sensitive parsing. It allows formatting date in any user-friendly way.
import java.util.*; import java.text.*; public class DateFormatExample { public static void main(String args[]) { Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); System.out.println("Current Date: " + ft.format(dNow)); } }
The output of the above program is
Current Date: Sun 20019.07.18 at 04:14:09 PM PDT
SimpleDateFormat FORMATTING CODES:
ASCII letters reserved as pattern letter are as follows:
ASCII LETTER Description Example G Era designator AD y Year in four digits 2019 M Month in year July or 07 d Day in month 10 h Hour in A.M./P.M. (1~12) 12 H Hour in day (0~23) 22 m Minute in hour 30 s Second in minute 55 S Millisecond 1564725881 E Day in week Tuesday D Day in year 365 F Day of week in the month 2 (second Wed. in July) w Week in year 40 W Week in month 1 a A.M./P.M. marker PM k Hour in day (1~24) 24 K Hour in A.M./P.M. (0~11) 10 z Time zone Eastern Standard Time ' Escape for text Delimiter " Single quote `
FORMATTING Date object USING printf()
Note: to avoid passing argument multiple times while formatting using printf, better use "%1$s" where letter after % indicates the index of the argument to be used so to specify the index in printf, the index must follow % and then terminated by $.
- to use  the argument in the preceding formatting clause, use < flag.
e.g.
import java.util.Date; public class DateFormattingPrintfExmple { public static void main(String args[]) { // Instantiate a date object of class Date Date date = new Date(); // display formatted time and date using printf System.out.printf("%1$s %2$tB %2$td, %2$tY", "Due date:", date); } }
PARSING STRING IN DATE
SimpleDateFormat class has method parse() which can parse the string according to the format stored in the SimpleDateFormat.
import java.util.*; import java.text.*; public class ParsingStringIntoDateExample { public static void main(String args[]) { SimpleDateFormat sft = new SimpleDateFormat ("yyyy-MM-dd"); //initialize formatter with format String input = "2019-07-11"; System.out.print(input + " Parses as "); Date t; try { t = sft.parse(input); System.out.println(t); } catch (ParseException e) { System.out.println("Unparseable using " + ft); } } }
- lapsed time can be measured by taking the difference of milliseconds of start time and end time.
GregorianCalendar Overview
Apart from using Date() for date and time, GregorianCalendar instance can be used to create the calendar instance. It has various constructors to initialized the Calendar instance. By default, the constructor returns instance initialized with current time and time zone of the user. GregorianCalendar represents two eras AD and BC
Here is the constructor list of GregorianCalendar
Constructor  Description GregorianCalendar()  Constructs a default GregorianCalendar using the current time in the default time zone with the default locale. GregorianCalendar(int year, int month, int date) Constructs a GregorianCalendar with the given date set in the default time zone with the default locale. GregorianCalendar(int year, int month, int date, int hour, int minute) Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale. GregorianCalendar(int year, int month, int date, int hour, int minute, int second) Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale. GregorianCalendar(Locale aLocale) Constructs a GregorianCalendar based on the current time in the default time zone with the given locale. GregorianCalendar(TimeZone zone) Constructs a GregorianCalendar based on the current time in the given time zone with the default locale. GregorianCalendar(TimeZone zone, Locale aLocale) Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.
For more details on GregorianCalendar, please check Oracle Java documentation.
You are at the end of the article, Hope you enjoyed it. please share and subscribe for latest articles on technology.
You may like Understanding Java From Scratch and Java Interview MCQ
0 notes
sixtus01 · 6 years ago
Text
Java MCQ Practice Questions
Java MCQ Practice Questions
Java is a general-purpose programming language that is class-based, object-oriented. It is designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java applications are typically compiled to…
View On WordPress
0 notes
recruitmentpt · 8 years ago
Text
Job Opening
@recruitmentpt   #Reminder
#Pune fresher Candidates apply here👍🏼
#Raja Software Labs, Pune (Batch 2017 pass out).
#2017 Freshers apply here ! 2016 batch can also try !!!
#Salary : Rs 4 LPA
Date of Drive : 10 February 2017
Reporting Time : 1 PM
Venue : Bernoulli Hall, De Morgan Block,Chitkara University, Punjab Campus, Chandigarh – Patiala National Highway
Eligibility Criteria :
Year of Passing out : 2017 Batch Degree : BE / BTech / MCA Branches : CSE / IT Percentage Criteria : No Criteria No active backlogs Required Skills :
Strong programming skills in any object oriented language (Java, Swift, Objective-C, C#, C/C++) in desktop, server, or mobile environments Experience with mobile development and familiarity with Android Studio, XCode is a plus. Experience shipping prior applications are a big plus. Selection Process :
Written test (MCQ) (30 min) Programming test (it can be on paper or online ) (1 hour) Skype interview Face to face tech & HR interview Note : Above process is divided into two parts, first two rounds will happen on 10th February 2017 (Friday) at Chitkara University and after that skype interview will be scheduled may be on 10 th February 2017 (Friday) or after some days {Exact dates would be shared with the shortlisted students (who clears the Written Test and Programming Test)}. After skype interviews depending shortlisting number Team – Raja Software Labs, Pune will send their technical panel to conduct the face to face at Chitkara University and if the number of candidates is less then face to face interviews will be scheduled at Raja Software Labs, Pune office.
#Last date to register is 31 Jan 2017
Apply Here!!!
https://docs.google.com/…/1FAIpQLSdHxn0KhcXoy1H94…/viewform…
Website:www.recruitmentandplacements.com
0 notes
equal-growth · 5 years ago
Video
tumblr
Guys, Check this amazing online platform for developers. Who want to learn together, build career with other students and discuss with professionals for better understanding.🖥
Follow ➡️ Python_Techno for more content.
Python PROgrammersComputer programming (C, C++, C#, Python, Java, Android) developersComputer Science and Programming Language AcademyComputer Science,Information Technology MCQS & More- Shahnoor NasirpyThon programmers [beginner stage]
#python3 #python #Discord #platform #online #pythonprogramming #pythondeveloper #softwaredeveloper #softwareenginner #learning #profession #helpeachother
0 notes
equal-growth · 5 years ago
Photo
Tumblr media
Guys, Check this amazing online platform for developers. Who want to learn together, build career with other students and discuss with professionals for better understanding.🖥 Follow ➡️ Python_Techno for more content. Python PROgrammersComputer programming (C, C++, C#, Python, Java, Android) developersComputer Science and Programming Language AcademyComputer Science,Information Technology MCQS & More- Shahnoor NasirpyThon programmers [beginner stage] #python3 #python #Discord #platform #online #pythonprogramming #pythondeveloper #softwaredeveloper #softwareenginner #learning #profession #helpeachother
0 notes
siva3155 · 6 years ago
Text
300+ TOP MYSQL Objective Questions and Answers
MYSQL Multiple Choice Questions :-
1. The "father" of MySQL is ______. A. Michael Widenius B. Bill Joy C. Bill Gates D. Stephanie Wall E. Sigmund Velin Ans:  A 1: The main MySQL program that does all the data handling is called A. mysql B. mysqld C. mysql.exe D. httpd Ans:  B 2: To use MySQL on your computer, you'll need A. Perl, PHP or Java B. Some sort of client program to access the databases C. A Browser D. FTP and Telnet Ans:  B 3: MySQL comes with as standard with client libraries for: A. C only B. Java only C. Java and C D. Perl, PHP and C E. C, C# and the .NET environment, Java and Python Ans: A 4. What kind of replication is supported by the MySQL server? A. Multiple-master replication B. Master to slave replication C. Single file based clustering D. MySQL doesn't support replication Ans:  B 5: Internally information is held in tables. Which of these is NOT a valid format: A. BDB B. Isam99 C. MyIsam D. Hash E. Isam F. InnoDb Ans:  B 6: Commands passed to the MySQL daemon are written in A. Your choice from Perl, PHP, Java or some other languages B. English C. the Structured Query Language D. Swedish Ans: C 7: MySQL supports the complete SQL99 standard A. true B. false Ans: B 8: Which of these is not a valid name for a column A. Far B. Near C. To D. From Ans: B 9: In a LIKE clause, you can could ask for any value ending in "ton" by writing A. LIKE ton$ B. LIKE ^.*ton$ C. LIKE %ton D. LIKE *ton E. LIKE .*ton Ans:  C 10: Which of the following can add a row to a table? A. Alter B. Add C. Insert D. Create E. Update F. Commit Ans:  C
Tumblr media
MYSQL MCQs 11: Which of these commands will delete a table called XXX if you have appropriate authority: A. DROP XXX B. DELETE XXX WHERE confirm = "YES" C. DROP XXX WHERE confirm = "YES" D. DROP TABLE XXX E. DELETE XXX F. DELETE TABLE XXX Ans:  D 12: The USE command A. Is a pseudonym for the SELECT command B. Has been deprecated and should be avoided for security reasons C. Should be used to choose the database you want to use once you've connected to MySQL D. Is used to load code from another file Ans:  C 13: In a LIKE clause, you can ask for any 6 letter value by writing: A. LIKE ?????? B. LIKE .{6} C. LIKE ^.{6}$ D. LIKE ...... (that's six dots) E. LIKE ______ (that's six underscore characters) Ans:  E 14: MySQL runs on which operating systems? A. Unix and Linux only B. Linux and Mac OS-X only C. Unix, Linux, Windows and others D. Any operating system at all Ans:  C 15: MySQL Access security is controlled through A. MySQL login accounts, and priveliges set for each account B. The ID that the user logged into the server through, and priveliges set up for that account. C. A table of valid IP addresses, and priveliges set up for each IP address D. The normal login security is sufficient for MySQL, and it does not have any extra controls of its own. Ans:  A 16: Which of the following is NOT supported by MySQL A. Temporary (Hash) Tables B. Table Joining C. Stored Procedures D. Regular Expression Matching Ans:  C 17: One of the early proponents of relational database who laid down many of the principles we use to this day was: A. Xigang Koi B. Mahatma Coate C. Edgar Codd D. William Crawford E. Robert Langton Ans:  C 18: You are required to buy a license for MySQL if A. If you use it for longer than 30 days B. You use MySQL in a live application and not just for evaluation C. You incorporate it into a product that you sell D. You use it on a publicly accessible site E. You are never required to buy a license Ans:  C 19: Which of these is a valid call to a function (watch the spaces carefully!) A. CONCAT(  A  ,  B  ) B. CONCAT  (  A  ,  B  ) C. CONCAT(  "A"  ,  "B"  ) D. CONCAT  (  "A"  ,  "B"  ) E. CONCAT  (A,  B) F. CONCAT  ("A",  "B") Ans:  C 20: If you want to undo a GRANT, you should use A. REVOKE B. UNDO C. UNGRANT D. DELETE E. WITHDRAW F. ROLLBACK Ans:  A 21: How many distinct, different values can you hold in an enum field? A. 255 B. 7 C. 65535 D. 2 (True and False) Ans:  C 22: Which of the following is NOT available in MySQL: A. REVOKE B. FETCH C. LIKE D. JOIN E. SELECT Ans:  B 23: Which of these field types would be best to hold a film title? A. longblob B. tinytext C. mediumtext D. longtext E. tinyblob Ans:  B 24: The program called mysql is A. There isn't a program just called mysql B. A wrapper through which Java clients must connect to the databases C. A client program that lets you send SQL commands to the database engine D. The database engine E. A program that starts up and shuts down the database engine Ans:  C 25: In a LIKE clause, you can ask for any 6 letter value by writing: A. LIKE ______ (that's six underscore characters) B. LIKE .{6} C. LIKE ?????? D. LIKE ^.{6}$ E. LIKE ...... (that's six dots) Ans:  A 26: Which of the following is available in MySQL: A. CREATE VIEW B. CREATE SCHEMA C. CREATE TRIGGER D. CREATE DATABASE E. CREATE FAIRYLIGHTS Ans:  D 27: Which of these field types would be best to hold a .jpg image? A. char binary B. nchar binary C. text D. blob Ans:  D 28: If you're writing a client using the C language API, your source code should include the following line at the top: A. use mysql; B. include ("mysql.h"); C. #include D. import com.mysql.*; Ans:  C 29: A user with RELOAD priveliges can A. Can reset passwords for any mysql user account B. Perform certain "admin type" operations such as flush table and logs from memory to disc, but can't normally do anything "dangerous" C. Can repopulate the databases and tables from a backup D. Can restart the MySQL daemon in addition to any other priveliges he might also have Ans:  B 30: What's the difference between the DESCRIBE and SHOW FIELDS FROM commands? A. Only SHOW FIELDS FROM can take a LIKE clause B. Nothing - they're the same thing C. Only DESCRIBE can take a LIKE clause Ans:  B 31: Which of these is not a valid name for a column A. To B. From C. Far D. Near Ans:  B 32: Commands passed to the MySQL daemon are written in A. English B. Your choice from Perl, PHP, Java or some other languages C. the Structured Query Language D. Swedish Ans:  C 33: Which of the following is available in MySQL: A. CREATE TRIGGER B. CREATE SCHEMA C. CREATE FAIRYLIGHTS D. CREATE DATABASE E. CREATE VIEW Ans:  D 34: One of the early proponents of relational database who laid down many of the principles we use to this day was: A. Edgar Codd B. Xigang Koi C. Robert Langton D. Mahatma Coate E. William Crawford Ans:  A MYSQL Questions and Answers pdf Download Read the full article
0 notes